#include <iostream>
#include <conio.h>

int recursion_version(int );
int iterativ_version(int );

int main()
{

	int number = 0;

	do{
		std::cout << "number = ";
		std::cin >> number;
	}
	while(number < 0);
	if(number == 0){
		std::cout << "factorial = " << 1 << std::endl; 
	}
	else{
		std::cout << "iterativ version   " << iterativ_version(number) << std::endl;
		std::cout << "recursion version   " << recursion_version(number) << std::endl;
	}

	getch();
	return 0;
}

//functions

int recursion_version(int number)
{
	if(1 == number){
		return 1;
	}
	else{
		return number * recursion_version(number - 1);
	}
}
int iterativ_version(int number)
{
	int result = 1;
	for(int i = 1 ; i <= number ; i++)
	{
		result *= i;
	}
	return result;
}